<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/publicMacro.ftl">
<#import "/macro/pagination.ftl" as Pagination>

<@header title="部门列表">
    <link href="${ctx}/resource/common/css/pagination.css" rel="stylesheet">
    <link href="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.min.css" rel="stylesheet">
</@header>

<@body>
    <h2 class="module-title">部门管理</h2>

    <div class="alert alert-primary" role="alert">
        <form class="form-inline form-margin" action="${ctx}/imDepartment/list">
            <div class="form-group mb-2">
                <label for="name" class="ml-2">部门名称：</label>
                <input type="text" class="form-control" id="name" name="name" value="${imDepartment.name}">
            </div>
            <div class="form-group mb-2">
                <label for="code" class="ml-2">部门编码：</label>
                <input type="text" class="form-control" id="code" name="code" value="${imDepartment.code}">
            </div>
            <div class="form-group mb-2">
                <label for="parentId" class="ml-2">上级部门id：</label>
                <input type="text" class="form-control" id="parentId" name="parentId" value="${imDepartment.parentId}">
            </div>
                <!--  do nothing -->
                <!--  do nothing -->
                <!--  do nothing -->
                <!--  do nothing -->
            <div class="form-group mb-2">
                <label for="tenantCode" class="ml-2">租户id：</label>
                <input type="text" class="form-control" id="tenantCode" name="tenantCode" value="${imDepartment.tenantCode}">
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="startCreateTime" class="ml-2">开始创建时间：</label>
                <input type="text" class="form-control" name="startCreateTime" id="startCreateTime" aria-describedby="创建时间" placeholder="创建时间" value="${(imDepartment.startCreateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endCreateTime" class="ml-2">结束创建时间：</label>
                <input type="text" class="form-control" name="endCreateTime" id="endCreateTime" aria-describedby="创建时间" placeholder="创建时间" value="${(imDepartment.endCreateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="startUpdateTime" class="ml-2">开始更新时间：</label>
                <input type="text" class="form-control" name="startUpdateTime" id="startUpdateTime" aria-describedby="更新时间" placeholder="更新时间" value="${(imDepartment.startUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endUpdateTime" class="ml-2">结束更新时间：</label>
                <input type="text" class="form-control" name="endUpdateTime" id="endUpdateTime" aria-describedby="更新时间" placeholder="更新时间" value="${(imDepartment.endUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
                <!--  do nothing -->

            <div class="form-group mx-sm-3 mb-2">
                <button type="submit" class="btn btn-primary">查询</button>
            </div>

            <@shiro.hasPermission name="imDepartment:toAdd">
            <div class="form-group mx-sm-3 mb-2" style="float:right">
                <span style="float:left"><a href="${ctx}/imDepartment/toAdd">添加数据</a></span>
            </div>
            </@shiro.hasPermission>
        </form>
    </div>

    <div class="table-responsive">
        <table class="table table-striped table-bordered">
            <thead>
                <th>主键</th>
                <th>部门名称</th>
                <th>部门编码</th>
                <th>上级部门id</th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th>租户id</th>
                <th>创建时间</th>
                <th>更新时间</th>
                <th></th>
                <th>操作</th>
            </thead>
            <tbody>
            <#list imDepartments.beans as imDepartment>
                <tr>
                    <th>${imDepartment.id!}</th>
                    <th>${imDepartment.name!}</th>
                    <th>${imDepartment.code!}</th>
                    <th>${imDepartment.parentId!}</th>
                    <th>${imDepartment.description!}</th>
                    <th>${imDepartment.managerUserId!}</th>
                    <th>${imDepartment.enable!}</th>
                    <th>${imDepartment.otherManagerUserIds!}</th>
                    <th>${imDepartment.tenantCode!}</th>
                    <th>${(imDepartment.createTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${(imDepartment.updateTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${(imDepartment.clientUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th><@shiro.hasPermission name="imDepartment:view"><a class="btn btn-primary btn-sm" href="${ctx}/imDepartment/view/${imDepartment.id?c}" role="button" aria-pressed="true">详情</a></@shiro.hasPermission>
                        <@shiro.hasPermission name="imDepartment:edit"><a class="btn btn-info btn-sm" href="${ctx}/imDepartment/toEdit/${imDepartment.id?c}" role="button" aria-pressed="true">编辑</a></@shiro.hasPermission>
                    </th>
                </tr>
            </#list>
            </tbody>
        </table>

        <@Pagination.pagination formId="imDepartmentForm"
            pageNo=imDepartments.pageNo
            pageTotal=imDepartments.pageTotal
            total=imDepartments.total
            pageSize=imDepartments.pageSize
            action="${ctx}/imDepartment/list">
        </@Pagination.pagination>
    </div>
</@body>

<@footer>
    <script src="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.full.min.js"></script>

    <script type="text/javascript">
        $(function () {
                $('#startCreateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endCreateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startClientUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endClientUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
        });
    </script>

    <script src="${ctx}/resource/common/js/pagination.js"></script>
    <script src="${ctx}/resource/common/js/jquery.validate.min.js"></script>
</@footer>